<%@ taglib prefix="app" uri="/app-tags"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>

<tiles:insertTemplate template="/tiles/layout.jsp">
	<tiles:putAttribute name="selected" value="planes" />
	<tiles:putAttribute name="submenu">
		<ul>
			<sec:authorize access="hasRole('ROLE_ADMIN')">
			<li><a href="${pageContext.request.contextPath}/planes/nuevo-plan.action" class="pagenew">Nuevo Plan</a></li>
			<li><a href="${pageContext.request.contextPath}/planes/liquidar.action" class="pagenew">Liquidar Planes</a></li>
			</sec:authorize>
		</ul>
	</tiles:putAttribute>
	
	<tiles:putAttribute name="body">
		
		<app:tablefilter tableId="planes"></app:tablefilter>
				
		<div id="box"> 
        <h3>Planes de pago</h3>
			<table id="planes" width="100%"> 
				<thead> 
					<tr>
						<th width="40px">ID</th>
						<th>Responsable del plan</th>
						<th>Monto del plan</th>
						<th>Nombre del Edificio</th>
						<th width="60px">Acciones</th>
					</tr> 
				</thead> 
				<tbody>
					<c:forEach var="plan" items="${planes}">
						<tr>
							<td><c:out value="${plan.id}" /></td>
							<td><c:out value="${plan.responsable.nombre}" /></td>
							<td>$<c:out value="${plan.monto}" /></td>
							<td><c:out value="${plan.edificio.nombre}" /></td>
							<td>
							<a href="${pageContext.request.contextPath}/planes/detalle.action?plan.id=${plan.id}">
							<img src="${pageContext.request.contextPath}/img/icons/report.png" title="Detalle" width="16" height="16" /></a>		
							
							<a href="${pageContext.request.contextPath}/planes/detalle-plan-pdf.action?plan.id=${plan.id}">
							<img src="${pageContext.request.contextPath}/img/icons/pdf.png" title="Detalle" width="16" height="16" /></a>		
							</td>
						</tr>
				</c:forEach>
					</tbody>
					</table>
					
                </div>

	</tiles:putAttribute>
</tiles:insertTemplate>